Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShoppingException を使用する #156

Open
wants to merge 2 commits into
base: next-poc
Choose a base branch
from

Conversation

nanasess
Copy link
Collaborator

@nanasess nanasess commented Sep 8, 2023

ShoppingException, AbstractMutation を実装して、 Warning や購入エラーのエラーハンドリングをする

Warning の例

Mutation の結果と共に、 PurchaseFlow の warning を出力する

mutation orderMutation {
  orderMutation {
    id
    OrderItems {
      id
      product_name
    }
  }
}
{
  "errors": [
    {
      "message": "「チェリーアイスサンド」の販売価格が変更されました。",
      "extensions": {
        "level": "warning",
        "category": "Global"
      }
    }
  ],
  "data": {
    "orderMutation": {
      "id": "31",
      "OrderItems": [
        {
          "id": "164",
          "product_name": "チェリーアイスサンド"
        }
      ]
    }
  }
}

Error の例

PurchaseFlow の Error のみを出力する

mutation orderMutation {
  orderMutation {
    id
    OrderItems {
      id
      product_name
    }
  }
}
{
  "errors": [
    {
      "message": "ご注文手続きが正常に完了しませんでした。大変お手数ですが、再度ご注文手続きをお願いします。",
      "extensions": {
        "level": "danger",
        "category": "Global"
      }
    }
  ],
  "data": {
    "orderMutation": null
  }
}

TODO

  • warning を返す箇所は AbstractMutation::addWarning を使用する

@nanasess nanasess force-pushed the use-shoppingexception branch from 750c291 to 15d5403 Compare September 13, 2023 04:45
@nanasess nanasess marked this pull request as ready for review September 15, 2023 05:31
@kiy0taka
Copy link
Contributor

関連
#149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants